<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>登录</title>
<!-- CSS -->
<link rel="stylesheet" href="/assets/amazeui/css/amazeui.min.css">
	<link rel="stylesheet" href="/css/app.css">
		<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
		<!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
</head>
<body>
	<header> </header>
	<div class="log"
		style="background: url(/assets/amazeui/i/f10.jpg) #000 no-repeat; background-size: 100% 100%; color: #ffffff;">
		<div class="am-g">
			<div
				class="am-u-lg-3 am-u-md-6 am-u-sm-8 am-u-sm-centered log-content">
				<h1 class="log-title am-animation-slide-top">Login</h1>
				<br>
					<form class="am-form" id="log-form">
						<div class="am-input-group am-radius am-animation-slide-left">
							<input type="email" name="username" id="doc-vld-email-2-1"
								class="am-radius username" data-validation-message="请输入正确用户名"
								placeholder="用户名" required /> <span
								class="am-input-group-label log-icon am-radius"><i
								class="am-icon-user am-icon-sm am-icon-fw"></i></span>
						</div>
						<br>
							<div
								class="am-input-group am-animation-slide-left log-animation-delay">
								<input type="password"
									class="am-form-field am-radius log-input password"
									name="password" placeholder="密码" minlength="6" required>
									<span class="am-input-group-label log-icon am-radius"><i
										class="am-icon-lock am-icon-sm am-icon-fw"></i></span>
							</div> <br>
								<button type="button" onclick="login()"
									class="am-btn am-btn-primary am-btn-block am-btn-lg am-radius am-animation-slide-bottom log-animation-delay">登
									录</button>
								<div
									class="am-btn-group  am-animation-slide-bottom log-animation-delay-b">
								</div>
					</form>
			</div>
		</div>
		<footer class="log-footer"> © 2017 AllMobilize, Inc. Licensed
		under MIT license. </footer>
	</div>
	<script src="/js/jquery.js"></script>
	<script src="/assets/layer/layer.js"></script>
	<script src="/js/scripts.js"></script>
	<script type="text/javascript">
		//enter键提交表单
		$('.am-form').bind("keydown", function(event) {
			if (event.keyCode == 13) {
				login();
				document.getElementByIdx_x("password").value = "";
			}
		})

		function login() {
			$.ajax({
				url : "/dologin",
				type : "get",
				dataType : "json",
				async : false,
				data : {
					"username" : $(".username").val(),
					"password" : $(".password").val(),
				//"imgCode" : $(".imgCode").val(),
				},
				success : function(data) {
					if (data.ok === true) {
						layer.msg("登录成功,即将跳转", {
							shift : 1
						});
						setTimeout(function() {
							window.location.href = "/index"
						}, 3000);
					} else {
						//$("#image_code").click();
						layer.msg(data.message, {
							shift : 6
						});
					}
				}
			})
		}
	</script>
</body>
</html>

